<%-- 
    Document   : index
    Created on : 23/05/2012, 11:10:58
    Author     : luiz.perez
--%>

<%@page import="javax.swing.text.Document"%>
<%@page import="java.sql.ResultSet"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="style.css" />
        <title>Login</title>
    </head>
    <body>
        <h1>LOGIN!</h1>
        <div id="divLogin">
        
        <jsp:useBean id="usuario" scope="page" class="org.neg.usuario.Usuario" />
        <%
            if(session.getAttribute("nome") != null){
                String nome = session.getAttribute("nome").toString();
                String tipo = session.getAttribute("tipo").toString();
                if(tipo.equals("A")) {
                    tipo = "Aluno ";
                }
                else if(tipo.equals("P")){
                    tipo = "Professor ";
                }
                else {
                    tipo = "";
                }
                out.write("Bem vindo, " + tipo + "" + nome + "! <a href=\"logout.jsp\"> Logout</a>");
            }
            else{
                out.write("<form name=\"FormLogin\" action=\"logado.jsp\" method=\"post\">"
                        + "Email:<br> <input type=\"text\" name=\"login\" /><br>"
                        + "Senha:<br> <input type=\"password\" name=\"senha\" /><br>"
                        + "<input id=\"btnSetLocal\" type=\"submit\" value=\"Entrar\" /></form><br><a href=\"cadastro.jsp\">Cadastre-se</a>");
            }
        %>
        </div>
    </body>
</html>